Create random passwords with a chosen length and a specified number of numbers. Uses both lower case and capital letters, which are chosen at random. And example is: wep5Q268LtTe

Just add to the appropriate page and call the procedure like passwordGen(12,4) for a password 12 letters long with 4 numbers like in the example: wep5Q268LtTe

========================================================

function passwordGen($length,$nums){
		$lowLet = "abcdefghijklmnopqrstuvwxyz";
		$highLet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		$numbers = "123456789";
		$pass = "";
		$i = 1;
		While ($i <= $length){
			$type = rand(0,1);
			if ($type == 0){
				if (($length-$i+1) > $nums){
					$type2 = rand(0,1);
					if ($type2 == 0){
						$ran = rand(0,25);
						$pass .= $lowLet[$ran];
					}else{
						$ran = rand(0,25);
						$pass .= $highLet[$ran];
					}
				}else{
					$ran = rand(0,8);
					$pass .= $numbers[$ran];
					$nums--;
				}
			}else{
				if ($nums > 0){
					$ran = rand(0,8);
					$pass .= $numbers[$ran];
					$nums--;
				}else{
					$type2 = rand(0,1);
					if ($type2 == 0){
						$ran = rand(0,25);
						$pass .= $lowLet[$ran];
					}else{
						$ran = rand(0,25);
						$pass .= $highLet[$ran];
					}
				}
			}
			$i++;
		}
		return $pass;
}
